package service.impl;

import enums.LogLevel;
import service.Logger;

/**
 * 数据库日志记录器 - 具体产品
 */
public class DatabaseLogger implements Logger {
    private String connectionString;
    private LogLevel level = LogLevel.INFO;
    
    public DatabaseLogger(String connectionString) {
        this.connectionString = connectionString;
        System.out.println("初始化数据库日志记录器，连接字符串: " + connectionString);
    }
    
    @Override
    public void log(String message) {
        // 模拟写入数据库
        System.out.println("[数据库日志][" + level + "] " + message);
        System.out.println("消息已写入数据库: " + connectionString);
    }
    
    @Override
    public void setLevel(LogLevel level) {
        this.level = level;
    }
    
    @Override
    public LogLevel getLevel() {
        return level;
    }
}